<template>
	<view class="mainbgc">
		<header-top :messageInfo="{typeFlag:true,message:'库存盘点',liner:false}"></header-top>
		<view class="mainpadding">
			<view class="titletext maincolor_text flexcenter" >选择仓库</view>
			<view class="mainpadding seletcangku flexbetween ffffff radius" @click="selectRole('/pages/workbench/jiben/cangkuda?type=1')">
				<input type="text" placeholder="请选择仓库" disabled="true" v-model="warehouse_name">
				<view class="righticon"></view>
			</view>
		</view>
		<view class="needposi">
			<view class="botton" @click="tianjia">开始盘点</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				warehouse_id: "",
				warehouse_name: "",
			}
		},
		onShow() {
			uni.$off("ckSelectFn")
			uni.$on("ckSelectFn", data => {
				this.warehouse_id = data.id
				this.warehouse_name = data.name
			})
		},
		methods: {
			selectRole(url) {
				uni.navigateTo({
					url
				})
			},
			//跳转添加商品页面
			tianjia() {
				// 开始盘点
				let _this = this
				httpRequest.request('/dhtapi/Warehouse/addWarehousePd', 'POST', {
					warehouse_id: this.warehouse_id
				}, false, false, true).then(res => {
					if (res.code == 1) {
						uni.redirectTo({
							url: '/pages/workbench/kucun/pandiandan?id='+res.data.id
						})
					} else {
						httpRequest.toast(res.msg)
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
		},
	}
</script>

<style lang="scss" scoped>
	.maincolor_text {
		margin-top: 100rpx;
		color: #0BBDCB;
	}

	.seletcangku {
		margin-top: 70rpx;
	}

	.needposi {
		position: fixed;
		width: 100%;
		bottom: 50rpx;
		left: 0;
		padding: 0 40rpx;
		box-sizing: border-box;
	}

	.botton {
		border-radius: 50rpx;
		background-color: #00B855;
		padding: 20rpx 0;
		text-align: center;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
	}
</style>
